package c1763;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class G {
    public static void main(String[] args) {
        QuickInput sc = new QuickInput();
        while (sc.hasNext()) {
            int n = sc.nextInt();
            int[] arr = new int[n];
            int[] dp = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = sc.nextInt();
                dp[i] = 1;
            }
            for (int i = 0; i < n - 1; i++) {
                for (int j = i + 1; j < n; j++) {
                    if (arr[i] >= arr[j] && (dp[i] + 1) > dp[j]) {
                        dp[j] = dp[i] + 1;
                    }
                }
            }
            Arrays.sort(dp);
            System.out.println(dp[n - 1]);
        }
    }

    static class QuickInput {
        BufferedReader buf;
        StringTokenizer tok;

        QuickInput() {
            buf = new BufferedReader(new InputStreamReader(System.in));
        }

        boolean hasNext() {
            while (tok == null || !tok.hasMoreElements()) {
                try {
                    tok = new StringTokenizer(buf.readLine());
                } catch (Exception e) {
                    return false;
                }
            }
            return true;
        }

        String next() {
            if (hasNext()) return tok.nextToken();
            return null;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }


    }
}